package com.welfare.generator.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * 读取代码生成相关配置
 * 
 * @author welfare
 */
@Component
@ConfigurationProperties(prefix = "gen")
@PropertySource(value = { "classpath:generator.yml" })
public class GenConfig
{
    /** 作者 */
    public static String author;

    /** 生成包路径 */
    public static String packageName;

    /** 自动去除表前缀，默认是false */
    public static boolean autoRemovePre;

    /** 表前缀(类名不会包含表前缀) */
    public static String tablePrefix;

    /** 数据库名称 */
    public static String dataBase;
    /** 具体表名**/
    public static String tableIn;
    /** 生成表前缀筛选条件(批量生成使用) */
    public static String tablePrefixBath;


    public static String jdbcDriver;
    public static String jdbcUrl;
    public static String jdbcUserName;
    public static String jdbcPwd;


    public static String getDataBase() {
        return dataBase;
    }
    @Value("${dataBase}")
    public void setDataBase(String dataBase) {
        GenConfig.dataBase = dataBase;
    }

    public static String getTableIn() {
        return tableIn;
    }
    @Value("${tableIn}")
    public void setTableIn(String tableIn) {
        GenConfig.tableIn = tableIn;
    }

    public static String getTablePrefixBath() {
        return tablePrefixBath;
    }
    @Value("${tablePrefixBath}")
    public void setTablePrefixBath(String tablePrefixBath) {
        GenConfig.tablePrefixBath = tablePrefixBath;
    }

    public static String getAuthor()
    {
        return author;
    }

    @Value("${author}")
    public void setAuthor(String author)
    {
        GenConfig.author = author;
    }

    public static String getPackageName()
    {
        return packageName;
    }

    @Value("${packageName}")
    public void setPackageName(String packageName)
    {
        GenConfig.packageName = packageName;
    }

    public static boolean getAutoRemovePre()
    {
        return autoRemovePre;
    }

    @Value("${autoRemovePre}")
    public void setAutoRemovePre(boolean autoRemovePre)
    {
        GenConfig.autoRemovePre = autoRemovePre;
    }

    public static String getTablePrefix()
    {
        return tablePrefix;
    }

    @Value("${tablePrefix}")
    public void setTablePrefix(String tablePrefix)
    {
        GenConfig.tablePrefix = tablePrefix;
    }

    public static String getJdbcDriver() {
        return jdbcDriver;
    }
    @Value("${jdbcDriver}")
    public void setJdbcDriver(String jdbcDriver) {
        GenConfig.jdbcDriver = jdbcDriver;
    }

    public static String getJdbcUrl() {
        return jdbcUrl;
    }
    @Value("${jdbcUrl}")
    public void setJdbcUrl(String jdbcUrl) {
        GenConfig.jdbcUrl = jdbcUrl;
    }

    public static String getJdbcUserName() {
        return jdbcUserName;
    }
    @Value("${jdbcUserName}")
    public void setJdbcUserName(String jdbcUserName) {
        GenConfig.jdbcUserName = jdbcUserName;
    }

    public static String getJdbcPwd() {
        return jdbcPwd;
    }
    @Value("${jdbcPwd}")
    public void setJdbcPwd(String jdbcPwd) {
        GenConfig.jdbcPwd = jdbcPwd;
    }
}
